import request from '@/utils/request'


/* 控制计划 */
/************************************************************************************/

// 创建控制计划
/*
data:
createReqVO:{
  "dataQuality": "", // 数据质量管理规定
  "remark": "", // 备注
  "revisionContents": "", // 制定（修订）内容
  "revisionTime": "", // 制定（修订）时间
  "version": "" // 版本号
}
*/
export function createControlPlan(data) {
  return request({
    url: '/enterprise/control-plan/create',
    method: 'POST',
    data: data
  })
}

// 获得控制计划分页
export function getControlPlanList(query) {
  return request({
    url: '/enterprise/control-plan/page',
    method: 'get',
    params: query
  })
}

/**
 {
 "dataQuality": "",
 "id": 0,
 "remark": "",
 "revisionContents": "",
 "revisionTime": "",
 "version": ""
 }
 */

// 更新控制计划
export function updateControlPlan(data) {
  console.log(data)
  return request({
    url: '/enterprise/control-plan/update',
    method: 'put',
    data: data
  })
}


// 删除控制计划
export function deleteControlPlan(query) {
  return request({
    url: '/enterprise/control-plan/delete',
    method: 'delete',
    params: query
  })
}

// 创建组织基本信息
export function createOrganization(data) {
  return request({
    url: '/enterprise/organization/create',
    method: 'POST',
    data: data
  })
}

// 获得组织基本信息
export function getOrganization(query) {
  return request({
    url: '/enterprise/organization/get',
    method: 'get',
    params: query
  })
}

// 更新组织基本信息
export function updateOrganization(data) {
  return request({
    url: '/enterprise/organization/update',
    method: 'put',
    data: data
  })
}

// 创建主营产品或服务
export function createService(data) {
  return request({
    url: '/enterprise/service/create',
    method: 'POST',
    data: data
  })
}

// 删除主营产品或服务
export function deleteService(query) {
  return request({
    url: '/enterprise/service/delete',
    method: 'delete',
    params: query
  })
}

// 获得主营产品或服务
export function getService(query) {
  return request({
    url: '/enterprise/service/get',
    method: 'get',
    params: query
  })
}

// 获得主营产品或服务列表
export function getServiceList(query) {
  return request({
    url: '/enterprise/service/list',
    method: 'get',
    params: query
  })
}

// 获得主营产品或服务分页
export function getServiceListByPage(query) {
  return request({
    url: '/enterprise/service/page',
    method: 'get',
    params: query
  })
}

// 更新主营产品或服务
export function updateService(data) {
  return request({
    url: '/enterprise/service/update',
    method: 'put',
    data: data
  })
}

// 创建组织边界
export function createBoundary(data) {
  return request({
    url: '/enterprise/boundary/create',
    method: 'POST',
    data: data
  })
}

// 获得组织边界
export function getBoundary(query) {
  return request({
    url: '/enterprise/boundary/get',
    method: 'get',
    params: query
  })
}

// 更新组织边界
export function updateBoundary(data) {
  return request({
    url: '/enterprise/boundary/update',
    method: 'put',
    data: data
  })
}

// 创建数据管理计划
export function createDataManage(data) {
  return request({
    url: '/enterprise/data-manage/create',
    method: 'POST',
    data: data
  })
}

// 获得数据管理计划
export function getDataManage(query) {
  return request({
    url: '/enterprise/data-manage/get',
    method: 'get',
    params: query
  })
}

// 获得数据管理计划列表
export function getDataManageList(data) {
  return request({
    url: '/enterprise/data-manage/list',
    method: 'post',
    data: data
  })
}

// 更新数据管理计划
export function updateDataManage(data) {
  return request({
    url: '/enterprise/data-manage/update',
    method: 'put',
    data: data
  })
}

// 获得控制计划
export function getControlPlan(query) {
  return request({
    url: '/enterprise/control-plan/get',
    method: 'get',
    params: query
  })
}

// 更新控制计划
export function updateDataControlPlan(data) {
  return request({
    url: '/enterprise/control-plan/update',
    method: 'put',
    data: data
  })
}

/************************************************************************************/

// 获得排放源
export function getEmissionSource(query) {
  return request({
    url: '/enterprise/emission-source/get',
    method: 'get',
    params: query
  })
}

// 获得排放源的温室气体列表
export function getEmissionSourceGasList(query) {
  return request({
    url: '/enterprise/emission-source/list-gas',
    method: 'get',
    params: query
  })
}

//获取排放源分页
export function getEmissionSourceList(query) {
  return request({
    url: '/enterprise/emission-source/page',
    method: 'get',
    params: query
  })
}

// 创建排放源
export function createEmissionSource(data) {
  return request({
    url: '/enterprise/emission-source/create',
    method: 'post',
    data: data
  })
}


//获得核算模型分页
export function getAccountingModel(query) {
  return request({
    url: '/enterprise/model/page',
    method: 'get',
    params: query
  })
}

// 获得核算报告分页
export function getAccountingReportByPage(query) {
  return request({
    url: '/enterprise/report/page',
    method: 'get',
    params: query
  })
}

// 获得核算模型分页
export function getAccountingModelByPage(query) {
  return request({
    url: '/enterprise/model/page',
    method: 'get',
    params: query
  })
}

// 创建核算模型
export function createAccountingModel(data) {
  return request({
    url: '/enterprise/model/create',
    method: 'post',
    data: data
  })
}

// 获得模型的排放源分页
export function getAccountingModelEmissionByPage(query) {
  return request({
    url: '/enterprise/model/page-emission',
    method: 'get',
    params: query
  })
}

// 创建模型的排放源
export function createAccountingModelAndEmission(data) {
  return request({
    url: '/enterprise/model/create-emission',
    method: 'post',
    data: data
  })
}

// 获得碳排放核算的排放源分页
export function getAccountingSourceByPage(query) {
  return request({
    url: '/enterprise/account/page-source',
    method: 'get',
    params: query
  })
}

// 获得碳排放核算分页
export function getAccountingByPage(query) {
  return request({
    url: '/enterprise/account/page',
    method: 'get',
    params: query
  })
}

// 创建碳排放核算
export function createAccount(data) {
  return request({
    url: '/enterprise/account/create',
    method: 'post',
    data: data
  })
}

// 创建碳排放核算的排放源
export function createAccountAndEmission(data) {
  return request({
    url: '/enterprise/account/create-source',
    method: 'post',
    data: data
  })
}

// 更新碳排放核算的排放源
export function updateAccountAndEmission(data) {
  return request({
    url: '/enterprise/account/update-source',
    method: 'put',
    data: data
  })
}

/************************************************************************************/


// 获取减排场景列表
export function getReductionSceneList() {
  return request({
    url: '/enterprise/reduction-scene/page',
    method: 'get',
  })
}

// 添加减排场景
export function createReductionScene(data) {
  return request({
    url: '/enterprise/reduction-scene/create',
    method: 'post',
    data: data
  })
}

// 获得排放基准
export function getEmissionBasis() {
  return request({
    url: '/enterprise/emission-basis/list',
    method: 'get',
  })
}

// 创建排放基准
export function createEmissionBasis(data) {
  return request({
    url: '/enterprise/emission-basis/create',
    method: 'post',
    data: data
  })
}

// 更新排放基准
export function updateEmissionBasis(data) {
  return request({
    url: '/enterprise/emission-basis/update',
    method: 'put',
    data: data
  })
}

// 获得核算报告分页
export function getEnterpriseReportByPage() {
  return request({
    url: '/enterprise/report/page',
    method: 'get',
  })
}

// 创建核算报告
export function createEnterpriseReport(data) {
  return request({
    url: '/enterprise/report/create',
    method: 'post',
    data: data
  })
}

// 创建核算报告的减排信息
export function createEnterpriseReportAndReduction(data) {
  return request({
    url: '/enterprise/report/create-reduction',
    method: 'post',
    data: data
  })
}

// 生成核算报告 Word
export function getEnterpriseReportWord(query) {
  return request({
    url: '/enterprise/report/export-word',
    method: 'get',
    params: query
  })
}

// 本地知识库问答
export function getLocalDocChat(data) {
  return request({
    url: '/enterprise/kb/local_doc_chat',
    method: 'post',
    data: data
  })
}

// 获得报告下载分页
export function getEnterpriseReportDownloadByPage(query) {
  return request({
    url: '/enterprise/report-download/page',
    method: 'get',
    params: query
  })
}

// 导出核算报告
export function getEnterpriseReportDownload(query) {
  return request({
    url: '/enterprise/report-download/export-word',
    method: 'get',
    params: query
  })
}
